package com.movisol.adsservice.client;

import java.util.StringTokenizer;

public class Ad {
     private String ActionType;
     private String ClickThroughUrl;
     private String Content;
     private String DestinationUrl;
     private String ImpressionTrackingUrl;
     private String Type;
     private String Properties;
     private double Weight;
	/**
	 * @return the actionType
	 */
	public String getActionType() {
		return ActionType;
	}
	/**
	 * @param actionType the actionType to set
	 */
	public void setActionType(String actionType) {
		ActionType = actionType;
	}
	/**
	 * @return the clickThroughUrl
	 */
	public String getClickThroughUrl() {
		return ClickThroughUrl;
	}
	/**
	 * @param clickThroughUrl the clickThroughUrl to set
	 */
	public void setClickThroughUrl(String clickThroughUrl) {
		ClickThroughUrl = clickThroughUrl;
	}
	/**
	 * @return the content
	 */
	public String getContent() {
		return Content;
	}
	/**
	 * @param content the content to set
	 */
	public void setContent(String content) {
		Content = content;
	}
	/**
	 * @return the destinationUrl
	 */
	public String getDestinationUrl() {
		return DestinationUrl;
	}
	/**
	 * @param destinationUrl the destinationUrl to set
	 */
	public void setDestinationUrl(String destinationUrl) {
		DestinationUrl = destinationUrl;
	}
	/**
	 * @return the impressionTrackingUrl
	 */
	public String getImpressionTrackingUrl() {
		return ImpressionTrackingUrl;
	}
	/**
	 * @param impressionTrackingUrl the impressionTrackingUrl to set
	 */
	public void setImpressionTrackingUrl(String impressionTrackingUrl) {
		ImpressionTrackingUrl = impressionTrackingUrl;
	}
	/**
	 * @return the type
	 */
	public String getType() {
		return Type;
	}
	/**
	 * @param type the type to set
	 */
	public void setType(String type) {
		Type = type;
	}
	/**
	 * @return the properties
	 */
	public String getProperties() {
		return Properties;
	}
	/**
	 * @param properties the properties to set
	 */
	public void setProperties(String properties) {
		Properties = properties;
	}
	/**
	 * @return the weight
	 */
	public double getWeight() {
		return Weight;
	}
	/**
	 * @param weight the weight to set
	 */
	public void setWeight(double weight) {
		Weight = weight;
	}
	public String getPropertyByName (String propertyName){
	
	StringTokenizer st= new StringTokenizer(getProperties(),"|");
		while (st.hasMoreTokens()){
		StringTokenizer st2= new StringTokenizer(st.nextToken(),":");
			while (st2.hasMoreTokens()){
				if (st2.nextToken().equalsIgnoreCase(propertyName)){
					return st2.nextToken();
				}
			}
		}
		return null;
		}
	}

